﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CYTools.Models.Model;
using System.Configuration;
using CYTools.Util;
using System.Data;
using System.Data.SqlClient;
using CYTools.Models.Dao;

namespace CYTools.Models.Service
{
    public class YclInfoService
    {
        public SqlConnection conn = null;
        public SqlTransaction stran = null;
        public Database db = new Database();
        /// <summary>
        /// 获取型材系列信息
        /// </summary>
        /// <returns></returns>
        public List<XilieInfo> getXlInfoList()
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                YclInfoDao xlDao = new YclInfoDao();
                List<XilieInfo> uinfo = xlDao.getXlInfoList(conn);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取型材信息
        /// </summary>
        /// <returns></returns>
        public List<XingCaiInfo> getXcInfoList()
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                YclInfoDao xcDao = new YclInfoDao();
                List<XingCaiInfo> uinfo = xcDao.getXcInfoList(conn);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取型材名称信息
        /// </summary>
        /// <returns></returns>
        public XingCaiInfo getXcDetailInfo(string Xc_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                YclInfoDao xcDao = new YclInfoDao();
                XingCaiInfo uinfo = xcDao.getXcDetailInfo(conn, Xc_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取配件信息
        /// </summary>
        /// <returns></returns>
        public List<PeiJianInfo> getPjInfoList()
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                YclInfoDao pjDao = new YclInfoDao();
                List<PeiJianInfo> uinfo = pjDao.getPjInfoList(conn);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 获取配件价格信息
        /// </summary>
        /// <returns></returns>
        public PeiJianInfo getPjDetailInfo(string Pj_id)
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                YclInfoDao pjDao = new YclInfoDao();
                PeiJianInfo uinfo = pjDao.getPjDetailInfo(conn,Pj_id);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
        /// <summary>
        /// 玻璃
        /// </summary>
        /// <returns></returns>
        public List<BoLiInfo> getBlInfoList()
        {
            try
            {
                conn = db.GetConn();
                conn.Open();
                YclInfoDao blDao = new YclInfoDao();
                List<BoLiInfo> uinfo = blDao.getBlInfoList(conn);
                return uinfo;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                db.CloseConnection(conn);
            }
        }
    }
}
